﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;

using Microsoft.BizTalk.Deployment;

namespace TCPSoftware.BizTalk.PipelineComponents.MockPipelineComponent
{
    [RunInstaller(true)]
    public partial class Installer : System.Configuration.Install.Installer
    {

        public Installer()
        {
            InitializeComponent();
        }

        public override void Uninstall(IDictionary savedState)
        {
            String PATHNAME = this.Context.Parameters["name1"];

            ConfigurationDatabase cd = new ConfigurationDatabase();
            Deployer d = new Deployer();
            d.Connection = cd.Connection;
            d.Undeploy(cd.Server, cd.Database, "TCPSoftware.BizTalk.Pipeline.MockPipeline", "1.0.0.0", "neutral", "673561f7041ac95c", System.IO.Path.Combine(System.IO.Path.GetTempPath(),"uninstall.log"));
            base.Uninstall(savedState);
        }

        public override void Install(IDictionary stateSaver)
        {
            String PATHNAME = this.Context.Parameters["name1"];

            ConfigurationDatabase cd = new ConfigurationDatabase();
            Deployer d = new Deployer();
            d.Connection = cd.Connection;
            d.Deploy(cd.Server, cd.Database, System.IO.Path.Combine(PATHNAME, "TCPSoftware.BizTalk.Pipeline.MockPipeline.dll"), "", false, System.IO.Path.Combine(System.IO.Path.GetTempPath(), "install.log"));

            base.Install(stateSaver);
        }
    }
}
